package day15.test03;

import java.io.IOException;
import java.net.*;

/**
 * @author Xiao
 * @date 2021/8/9
 */
public class Client03 {
    /**
     * 3. 使用UDP协议完成数据传输
     *     发送端发送，接收端接收
     */
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();
        byte[] bytes = "我爱Java！".getBytes();
        InetAddress address = InetAddress.getByName("127.0.0.1");
        DatagramPacket dp = new DatagramPacket(bytes,bytes.length,address,12345);
        ds.send(dp);
        ds.close();
    }
}
